<?php
	require_once 'base.dao.php';
	require_once 'company.vao.php';
	
	class CompanyManager extends BaseManager {	
		public function getCompanyById ($companyId) {
			$query = sprintf("select * from companies where id = %d",
							 $companyId);
			try {
				$result = $this->executeQuery($query);
				if (count($result) == 0)
					return null;
				extract($result[0]);
				return new Company($id,
								   $name,
								   $address,
								   $phone,
								   $fax,
								   $email);
			} catch (QueryException $e) {
				return null;
			}
		}
	}
?>